<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@page import="com.ubst.smartad.common.*" %>
<%@page import="com.ubst.smartad.env.*" %>
<%@page import="com.ubst.smartad.session.*" %>
<%@page import="com.ubst.smartad.logger.Debug" %>
<%@page import="net.sf.json.JSONArray"  %>
<%@page import="net.sf.json.JSONObject"  %>
<%@page import="java.util.HashMap" %>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.List" %>
<%@page import="java.io.PrintWriter" %>
<%@page import="com.ubst.smartad.dbpool.TransactionManager" %>
<%@page import="com.ubst.smartad.impl.admin.system.SystemMngImpl" %>
<%@include file="/jsp/inc/base.jsp"%>

<jsp:useBean id="tem" class="com.ubst.smartad.template.Template" scope="page"/>
<% 
// tem.setFileText( web_root+"skin1/test/test.html");
// tem.setReplaceKey("{TEST}", "aabbcc");

try{
	System.out.println("<!> insertSystemAdd ");
	System.out.println("request.getParameterMap() "+request.getParameterMap());
	
	/*
	*	setting
	*
	*//////////////////
	HashMap param = new HashMap();
	Boolean result = null;

	param.put("system_name", request.getParameter("system_name"));
	param.put("system_kind", request.getParameter("system_kind"));
	param.put("ip_addr", request.getParameter("ip_addr"));
	param.put("os_kind", request.getParameter("os_kind"));
	param.put("os_version", request.getParameter("os_version"));
	param.put("sid", request.getParameter("sid"));
	param.put("connect_way", request.getParameter("connect_way"));
	param.put("connect_port", request.getParameter("connect_port"));
	param.put("data_req", request.getParameter("data_req"));
	param.put("req_port", request.getParameter("req_port"));
	param.put("manage_account", request.getParameter("manage_account"));
	param.put("pw", request.getParameter("pw"));
	param.put("pw_check", request.getParameter("pw_check"));
	param.put("serverlock_pw", request.getParameter("serverlock_pw"));
	param.put("serverlock_pw_check", request.getParameter("serverlock_pw_check"));
	param.put("sys_ex", request.getParameter("sys_ex"));
	

	///////////////////

	SystemMngImpl systemMng = null;
	TransactionManager tm = new TransactionManager();
	
	systemMng = new SystemMngImpl(tm.connection, serverName, fhostEnv.getLogLevel());
	result = systemMng.insertSystemAdd(param);// insert result
	
	//JSONArray jsonArr = JSONArray.fromObject(workMap);
	JSONObject jsonObj = new JSONObject();
	if(result){
		jsonObj.put("result", "등록에 성공 하였습니다");		// result
	}else{
		jsonObj.put("result", "등록에 실패 하였습니다");
	}
	
	response.setContentType("text/plain; charset=utf-8"); 
	response.setHeader("Cache-Control", "no-cache"); 
	//PrintWriter out = response.getWriter();
	out.print(jsonObj.toString());
	System.out.println("jsonObj.toString() "+jsonObj.toString());
	out.flush();
}catch (Exception e) {			
}

%>			